package com.itcam.controller;

import jakarta.faces.annotation.RequestMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//4.演示路径参数的获取 - @PathVariable

@RestController
@RequestMapping("/hello04")
public class Hello04Controller {
    //http://localhost:8080/hello04/h01/jim/20/china
    @GetMapping("/h01/{uname}/{age}/{address}")
    public String h01(@PathVariable Integer age ,@PathVariable String address , @PathVariable String uname){
        System.out.println("uname = " + uname);
        System.out.println("age = " + age);
        System.out.println("address = " + address);
        return "succ" ;
    }

    //http://localhost:8080/hello04/h02/jim/20?address=china
    @GetMapping("/h02/{uname}/{age}")
    public String h02(@PathVariable Integer age ,String address , @PathVariable String uname){
        System.out.println("uname = " + uname);
        System.out.println("age = " + age);
        System.out.println("address = " + address);
        return "succ" ;
    }
}
